
var request = require('request-promise');
// let baseURL = 'https://unsplash.com/napi/photos'
const  ACCESS_KEY = 'GlkPAw53D3BRKxV4zGVZcn6Tp3JsyLUKm_armJR4URA'
const secretKey ='UCLdIHO3ZcVdZRmry0mTxTVLBarJjGISCI22KxlaZ5k' 
let baseURL = 'https://api.unsplash.com/photos'
const wallpaper = function (params) {
    // console.log('start', '12222222222222222222222222');
    return request({
        url: `${baseURL}`,
        qs: {
            per_page: params.per_page || 12,
            page: params.page || 1,
            client_id: ACCESS_KEY
            // xp: 'search-synonym:control'
        },
        headers: {
            "content-type": "application/json",
        },
        rejectUnauthorized: false,
        resolveWithFullResponse: true,
        json: true
    }).then(function (res) {
        // return res.data.HeWeather6[0];
        console.log(res, 'photos');
        return res;
    }).catch((error) => {
        console.log(error, 'error');
    })
}
module.exports = {
    wallpaper
}